<?php

namespace Sifast\ProjectBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class DiplomesAdmin extends Admin
{
 
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
        ->with('L1')
            ->add('niveau', 'choice', array(
                    'label'=> 'Niveau:',
                    'choices' => array(
                        "Choisir le niveau d'étude" => "Choisir le niveau d'étude",
                        'Bac' => 'Bac',
                        'Bac+3' => 'Bac+3',
                        'Bac+5' => 'Bac+5',
                        'Bac>5' => 'Bac>5',
                    )
                ))
            ->add('diplome','text',array(
                'label'=>'Diplôme:',
            ))    
        ->end()
        ->with('L2')        
            ->add('filiere','text',array(
                'label'=>'Filiére:',
            ))
               
            ->add('anneeObtentionDiplome', 'choice', array(
                    'label'=> 'Année obtention:',
                    'choices' => array(
                        "Choisir l'année" => "Choisir l'année",
                        '2013' => '2013',
                        '2012' => '2012',
                        '2011' => '2011',
                        '2010' => '2010',
                        '2009' => '2009',
                        '2008' => '2008',
                        '2007' => '2007',
                        '2006' => '2006',
                        '2005' => '2005',
                        '2004' => '2004',
                        '2003' => '2003',
                        '2002' => '2002',
                        '2001' => '2001',
                        '2000' => '2000',
                        '1999' => '1999',
                        '1998' => '1998',
                        '1997' => '1997',
                        '1996' => '1996',
                        '1995' => '1995',
                        '1994' => '1994',
                        '1993' => '1993',
                        '1992' => '1992',
                        '1991' => '1991',
                        '1990' => '1990',
                     
                    )
                ))
        ->end() 
        ->with('L3')        
            ->add('mention','text',array(
                'label'=>'Mention:',
            )) 
            ->add('dateDebut', 'date', array(
                    'label'=> 'Date de début:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
         ->end()
         ->with('L4')       
            ->add('dateFin', 'date', array(
                    'label'=> 'Date de fin:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
         ->end()   ;
            
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper 
            ->add('niveau')
            ->add('filiere')
            ->add('anneeObtentationDiplome')
            ->add('score') 
            ->add('dateDebut')
            ->add('dateFin');
            
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('niveau')
            ->add('filiere')
            ->add('anneeObtentationDiplome')
            ->add('score') 
            ->add('dateDebut')
            ->add('dateFin');
            
            }
}